using System;
using Provausio.Common.Objects;
using TrainingManagement.api.Models.Data.CRUD;
using TrainingManagement.api.Models.Data.CRUD.Department;

namespace TrainingManagement.api.Models.BusinessLogic.Department
{
    public class DepartmentDeleteOperation : BusinessOperation<int, bool>
    {
        readonly DepartmentDeleteDataSource _departmentDelete = new DepartmentDeleteDataSource();

        public override bool Run(int input)
        {
            if (_departmentDelete.Execute(input))
                return true;
            throw new Exception("Department deletion was unsuccessful.");
        }
    }
}